package cn.kelvin.adapter;

public class Token {
	public enum TokenType {
		LPAR, RPAR,
        PLUS,
        MINUS,
        MULT,
        DIV,
        INT,
        NONE,
	}
	
	TokenType tokenType;
	Object value;
	
	public Token(TokenType tokenType, Object value) {
		this.tokenType = tokenType;
		this.value = value;
	}

	@Override
	public String toString() {
		String val = String.valueOf(value);
		try {
			Integer.valueOf(val);
			return "{" + tokenType + ", INTEGER(" + value + ")}";
		} catch (Exception e) {
			return "{" + tokenType + ", " + '"'+val+'"' + "}";
		}
		
	}

	public TokenType getTokenType() {
		return tokenType;
	}

	public void setTokenType(TokenType tokenType) {
		this.tokenType = tokenType;
	}

	public Object getValue() {
		return value;
	}

	public void setValue(Object value) {
		this.value = value;
	}
	
	
	
	
}
